package ch07_GUI编程;

import java.awt.GridLayout;

import javax.swing.JButton;

public class GridLayoutDemo {
	public static void main(String[] args) {
		new GridLayoutDemo().init();
	}
	void init() {
		int row =5,col =4;
		BaseFrame f = new BaseFrame("GridLayout Demo");
		f.setLayout(new GridLayout(row,col,2,2));
		
		for (int i = 0; i < row*col; i++) {
			f.add(new JButton(""+(i+1)));
		}
		f.showMe();
	}
}
